﻿
namespace MyUtils
{
  #region Using's

  using System;
  using System.Linq;
  using System.Collections.Generic;
  using System.Diagnostics;

  #endregion Using's

          #region struct Tuple<T1, T2>

  [Serializable]
#if !PocketPC && !Smartphone
  [DebuggerDisplay("{ToString()}")]
#endif
  public struct Tuple<T1, T2> : IEquatable<Tuple<T1, T2>>
  {
    #region Fields

        private readonly T1 item1;
        private readonly T2 item2;
    
    #endregion Fields

    #region Constructors\Finalizer
    
        public Tuple(T1 item1, T2 item2) {
            this.item1 = item1;
            this.item2 = item2;
          }

    #endregion Constructors\Finalizer

    #region Properties

        public T1 Item1 {
      [DebuggerStepThrough]
      get { return item1; }
    }

        public T2 Item2 {
      [DebuggerStepThrough]
      get { return item2; }
    }
    
    #endregion Properties
    
    #region Methods

    public string ToString(IFormatProvider provider) {
      return Tuple.ToString(provider, Item1, Item2);
    }

    #endregion Methods

    #region Overrides

    public override bool Equals(object obj) {
            return obj is Tuple<T1, T2> && Equals((Tuple<T1, T2>)obj);
          }

    public override int GetHashCode() {
                    return EqualityComparer<T1>.Default.GetHashCode(Item1)
                              ^ Tuple.RotateRight(EqualityComparer<T2>.Default.GetHashCode(Item2), 1);                   }

    public override string ToString() {
      return ToString(null);
    }

    #endregion Overrides
    
    #region Operators

    public static bool operator ==(Tuple<T1, T2> left, Tuple<T1, T2> right) {
            return left.Equals(right);
          }

    public static bool operator !=(Tuple<T1, T2> left, Tuple<T1, T2> right) {
      return !(left == right);
    }

    #endregion Operators

    #region IEquatable<Tuple<T1, T2>> Members

    public bool Equals(Tuple<T1, T2> other) {
      return           EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 
               &&  EqualityComparer<T2>.Default.Equals(Item2, other.Item2) ;           }

    #endregion IEquatable<Tuple<T1, T2>> Members
  }

  #endregion struct Tuple<T1, T2>
  
          #region class Tuple<T1, T2, T3>

  [Serializable]
#if !PocketPC && !Smartphone
  [DebuggerDisplay("{ToString()}")]
#endif
  public sealed class Tuple<T1, T2, T3> : IEquatable<Tuple<T1, T2, T3>>
  {
    #region Fields

        private readonly T1 item1;
        private readonly T2 item2;
        private readonly T3 item3;
    
    #endregion Fields

    #region Constructors\Finalizer
    
        public Tuple() { }

        public Tuple(T1 item1, T2 item2, T3 item3) {
            this.item1 = item1;
            this.item2 = item2;
            this.item3 = item3;
          }

    #endregion Constructors\Finalizer

    #region Properties

        public T1 Item1 {
      [DebuggerStepThrough]
      get { return item1; }
    }

        public T2 Item2 {
      [DebuggerStepThrough]
      get { return item2; }
    }

        public T3 Item3 {
      [DebuggerStepThrough]
      get { return item3; }
    }
    
    #endregion Properties
    
    #region Methods

    public string ToString(IFormatProvider provider) {
      return Tuple.ToString(provider, Item1, Item2, Item3);
    }

    #endregion Methods

    #region Overrides

    public override bool Equals(object obj) {
            return Equals(obj as Tuple<T1, T2, T3>);
          }

    public override int GetHashCode() {
                    return EqualityComparer<T1>.Default.GetHashCode(Item1)
                              ^ Tuple.RotateRight(EqualityComparer<T2>.Default.GetHashCode(Item2), 1)
                              ^ Tuple.RotateRight(EqualityComparer<T3>.Default.GetHashCode(Item3), 2);                   }

    public override string ToString() {
      return ToString(null);
    }

    #endregion Overrides
    
    #region Operators

    public static bool operator ==(Tuple<T1, T2, T3> left, Tuple<T1, T2, T3> right) {
            return Equals(left, right);
          }

    public static bool operator !=(Tuple<T1, T2, T3> left, Tuple<T1, T2, T3> right) {
      return !(left == right);
    }

    #endregion Operators

    #region IEquatable<Tuple<T1, T2, T3>> Members

    public bool Equals(Tuple<T1, T2, T3> other) {
      return  other != null           &&  EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 
               &&  EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 
               &&  EqualityComparer<T3>.Default.Equals(Item3, other.Item3) ;           }

    #endregion IEquatable<Tuple<T1, T2, T3>> Members
  }

  #endregion sealed class Tuple<T1, T2, T3>
  
          #region class Tuple<T1, T2, T3, T4>

  [Serializable]
#if !PocketPC && !Smartphone
  [DebuggerDisplay("{ToString()}")]
#endif
  public sealed class Tuple<T1, T2, T3, T4> : IEquatable<Tuple<T1, T2, T3, T4>>
  {
    #region Fields

        private readonly T1 item1;
        private readonly T2 item2;
        private readonly T3 item3;
        private readonly T4 item4;
    
    #endregion Fields

    #region Constructors\Finalizer
    
        public Tuple() { }

        public Tuple(T1 item1, T2 item2, T3 item3, T4 item4) {
            this.item1 = item1;
            this.item2 = item2;
            this.item3 = item3;
            this.item4 = item4;
          }

    #endregion Constructors\Finalizer

    #region Properties

        public T1 Item1 {
      [DebuggerStepThrough]
      get { return item1; }
    }

        public T2 Item2 {
      [DebuggerStepThrough]
      get { return item2; }
    }

        public T3 Item3 {
      [DebuggerStepThrough]
      get { return item3; }
    }

        public T4 Item4 {
      [DebuggerStepThrough]
      get { return item4; }
    }
    
    #endregion Properties
    
    #region Methods

    public string ToString(IFormatProvider provider) {
      return Tuple.ToString(provider, Item1, Item2, Item3, Item4);
    }

    #endregion Methods

    #region Overrides

    public override bool Equals(object obj) {
            return Equals(obj as Tuple<T1, T2, T3, T4>);
          }

    public override int GetHashCode() {
                    return EqualityComparer<T1>.Default.GetHashCode(Item1)
                              ^ Tuple.RotateRight(EqualityComparer<T2>.Default.GetHashCode(Item2), 1)
                              ^ Tuple.RotateRight(EqualityComparer<T3>.Default.GetHashCode(Item3), 2)
                              ^ Tuple.RotateRight(EqualityComparer<T4>.Default.GetHashCode(Item4), 3);                   }

    public override string ToString() {
      return ToString(null);
    }

    #endregion Overrides
    
    #region Operators

    public static bool operator ==(Tuple<T1, T2, T3, T4> left, Tuple<T1, T2, T3, T4> right) {
            return Equals(left, right);
          }

    public static bool operator !=(Tuple<T1, T2, T3, T4> left, Tuple<T1, T2, T3, T4> right) {
      return !(left == right);
    }

    #endregion Operators

    #region IEquatable<Tuple<T1, T2, T3, T4>> Members

    public bool Equals(Tuple<T1, T2, T3, T4> other) {
      return  other != null           &&  EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 
               &&  EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 
               &&  EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 
               &&  EqualityComparer<T4>.Default.Equals(Item4, other.Item4) ;           }

    #endregion IEquatable<Tuple<T1, T2, T3, T4>> Members
  }

  #endregion sealed class Tuple<T1, T2, T3, T4>
  
          #region class Tuple<T1, T2, T3, T4, T5>

  [Serializable]
#if !PocketPC && !Smartphone
  [DebuggerDisplay("{ToString()}")]
#endif
  public sealed class Tuple<T1, T2, T3, T4, T5> : IEquatable<Tuple<T1, T2, T3, T4, T5>>
  {
    #region Fields

        private readonly T1 item1;
        private readonly T2 item2;
        private readonly T3 item3;
        private readonly T4 item4;
        private readonly T5 item5;
    
    #endregion Fields

    #region Constructors\Finalizer
    
        public Tuple() { }

        public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) {
            this.item1 = item1;
            this.item2 = item2;
            this.item3 = item3;
            this.item4 = item4;
            this.item5 = item5;
          }

    #endregion Constructors\Finalizer

    #region Properties

        public T1 Item1 {
      [DebuggerStepThrough]
      get { return item1; }
    }

        public T2 Item2 {
      [DebuggerStepThrough]
      get { return item2; }
    }

        public T3 Item3 {
      [DebuggerStepThrough]
      get { return item3; }
    }

        public T4 Item4 {
      [DebuggerStepThrough]
      get { return item4; }
    }

        public T5 Item5 {
      [DebuggerStepThrough]
      get { return item5; }
    }
    
    #endregion Properties
    
    #region Methods

    public string ToString(IFormatProvider provider) {
      return Tuple.ToString(provider, Item1, Item2, Item3, Item4, Item5);
    }

    #endregion Methods

    #region Overrides

    public override bool Equals(object obj) {
            return Equals(obj as Tuple<T1, T2, T3, T4, T5>);
          }

    public override int GetHashCode() {
                    return EqualityComparer<T1>.Default.GetHashCode(Item1)
                              ^ Tuple.RotateRight(EqualityComparer<T2>.Default.GetHashCode(Item2), 1)
                              ^ Tuple.RotateRight(EqualityComparer<T3>.Default.GetHashCode(Item3), 2)
                              ^ Tuple.RotateRight(EqualityComparer<T4>.Default.GetHashCode(Item4), 3)
                              ^ Tuple.RotateRight(EqualityComparer<T5>.Default.GetHashCode(Item5), 4);                   }

    public override string ToString() {
      return ToString(null);
    }

    #endregion Overrides
    
    #region Operators

    public static bool operator ==(Tuple<T1, T2, T3, T4, T5> left, Tuple<T1, T2, T3, T4, T5> right) {
            return Equals(left, right);
          }

    public static bool operator !=(Tuple<T1, T2, T3, T4, T5> left, Tuple<T1, T2, T3, T4, T5> right) {
      return !(left == right);
    }

    #endregion Operators

    #region IEquatable<Tuple<T1, T2, T3, T4, T5>> Members

    public bool Equals(Tuple<T1, T2, T3, T4, T5> other) {
      return  other != null           &&  EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 
               &&  EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 
               &&  EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 
               &&  EqualityComparer<T4>.Default.Equals(Item4, other.Item4) 
               &&  EqualityComparer<T5>.Default.Equals(Item5, other.Item5) ;           }

    #endregion IEquatable<Tuple<T1, T2, T3, T4, T5>> Members
  }

  #endregion sealed class Tuple<T1, T2, T3, T4, T5>
  
          #region class Tuple<T1, T2, T3, T4, T5, T6>

  [Serializable]
#if !PocketPC && !Smartphone
  [DebuggerDisplay("{ToString()}")]
#endif
  public sealed class Tuple<T1, T2, T3, T4, T5, T6> : IEquatable<Tuple<T1, T2, T3, T4, T5, T6>>
  {
    #region Fields

        private readonly T1 item1;
        private readonly T2 item2;
        private readonly T3 item3;
        private readonly T4 item4;
        private readonly T5 item5;
        private readonly T6 item6;
    
    #endregion Fields

    #region Constructors\Finalizer
    
        public Tuple() { }

        public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) {
            this.item1 = item1;
            this.item2 = item2;
            this.item3 = item3;
            this.item4 = item4;
            this.item5 = item5;
            this.item6 = item6;
          }

    #endregion Constructors\Finalizer

    #region Properties

        public T1 Item1 {
      [DebuggerStepThrough]
      get { return item1; }
    }

        public T2 Item2 {
      [DebuggerStepThrough]
      get { return item2; }
    }

        public T3 Item3 {
      [DebuggerStepThrough]
      get { return item3; }
    }

        public T4 Item4 {
      [DebuggerStepThrough]
      get { return item4; }
    }

        public T5 Item5 {
      [DebuggerStepThrough]
      get { return item5; }
    }

        public T6 Item6 {
      [DebuggerStepThrough]
      get { return item6; }
    }
    
    #endregion Properties
    
    #region Methods

    public string ToString(IFormatProvider provider) {
      return Tuple.ToString(provider, Item1, Item2, Item3, Item4, Item5, Item6);
    }

    #endregion Methods

    #region Overrides

    public override bool Equals(object obj) {
            return Equals(obj as Tuple<T1, T2, T3, T4, T5, T6>);
          }

    public override int GetHashCode() {
                    return EqualityComparer<T1>.Default.GetHashCode(Item1)
                              ^ Tuple.RotateRight(EqualityComparer<T2>.Default.GetHashCode(Item2), 1)
                              ^ Tuple.RotateRight(EqualityComparer<T3>.Default.GetHashCode(Item3), 2)
                              ^ Tuple.RotateRight(EqualityComparer<T4>.Default.GetHashCode(Item4), 3)
                              ^ Tuple.RotateRight(EqualityComparer<T5>.Default.GetHashCode(Item5), 4)
                              ^ Tuple.RotateRight(EqualityComparer<T6>.Default.GetHashCode(Item6), 5);                   }

    public override string ToString() {
      return ToString(null);
    }

    #endregion Overrides
    
    #region Operators

    public static bool operator ==(Tuple<T1, T2, T3, T4, T5, T6> left, Tuple<T1, T2, T3, T4, T5, T6> right) {
            return Equals(left, right);
          }

    public static bool operator !=(Tuple<T1, T2, T3, T4, T5, T6> left, Tuple<T1, T2, T3, T4, T5, T6> right) {
      return !(left == right);
    }

    #endregion Operators

    #region IEquatable<Tuple<T1, T2, T3, T4, T5, T6>> Members

    public bool Equals(Tuple<T1, T2, T3, T4, T5, T6> other) {
      return  other != null           &&  EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 
               &&  EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 
               &&  EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 
               &&  EqualityComparer<T4>.Default.Equals(Item4, other.Item4) 
               &&  EqualityComparer<T5>.Default.Equals(Item5, other.Item5) 
               &&  EqualityComparer<T6>.Default.Equals(Item6, other.Item6) ;           }

    #endregion IEquatable<Tuple<T1, T2, T3, T4, T5, T6>> Members
  }

  #endregion sealed class Tuple<T1, T2, T3, T4, T5, T6>
  
          #region class Tuple<T1, T2, T3, T4, T5, T6, T7>

  [Serializable]
#if !PocketPC && !Smartphone
  [DebuggerDisplay("{ToString()}")]
#endif
  public sealed class Tuple<T1, T2, T3, T4, T5, T6, T7> : IEquatable<Tuple<T1, T2, T3, T4, T5, T6, T7>>
  {
    #region Fields

        private readonly T1 item1;
        private readonly T2 item2;
        private readonly T3 item3;
        private readonly T4 item4;
        private readonly T5 item5;
        private readonly T6 item6;
        private readonly T7 item7;
    
    #endregion Fields

    #region Constructors\Finalizer
    
        public Tuple() { }

        public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) {
            this.item1 = item1;
            this.item2 = item2;
            this.item3 = item3;
            this.item4 = item4;
            this.item5 = item5;
            this.item6 = item6;
            this.item7 = item7;
          }

    #endregion Constructors\Finalizer

    #region Properties

        public T1 Item1 {
      [DebuggerStepThrough]
      get { return item1; }
    }

        public T2 Item2 {
      [DebuggerStepThrough]
      get { return item2; }
    }

        public T3 Item3 {
      [DebuggerStepThrough]
      get { return item3; }
    }

        public T4 Item4 {
      [DebuggerStepThrough]
      get { return item4; }
    }

        public T5 Item5 {
      [DebuggerStepThrough]
      get { return item5; }
    }

        public T6 Item6 {
      [DebuggerStepThrough]
      get { return item6; }
    }

        public T7 Item7 {
      [DebuggerStepThrough]
      get { return item7; }
    }
    
    #endregion Properties
    
    #region Methods

    public string ToString(IFormatProvider provider) {
      return Tuple.ToString(provider, Item1, Item2, Item3, Item4, Item5, Item6, Item7);
    }

    #endregion Methods

    #region Overrides

    public override bool Equals(object obj) {
            return Equals(obj as Tuple<T1, T2, T3, T4, T5, T6, T7>);
          }

    public override int GetHashCode() {
                    return EqualityComparer<T1>.Default.GetHashCode(Item1)
                              ^ Tuple.RotateRight(EqualityComparer<T2>.Default.GetHashCode(Item2), 1)
                              ^ Tuple.RotateRight(EqualityComparer<T3>.Default.GetHashCode(Item3), 2)
                              ^ Tuple.RotateRight(EqualityComparer<T4>.Default.GetHashCode(Item4), 3)
                              ^ Tuple.RotateRight(EqualityComparer<T5>.Default.GetHashCode(Item5), 4)
                              ^ Tuple.RotateRight(EqualityComparer<T6>.Default.GetHashCode(Item6), 5)
                              ^ Tuple.RotateRight(EqualityComparer<T7>.Default.GetHashCode(Item7), 6);                   }

    public override string ToString() {
      return ToString(null);
    }

    #endregion Overrides
    
    #region Operators

    public static bool operator ==(Tuple<T1, T2, T3, T4, T5, T6, T7> left, Tuple<T1, T2, T3, T4, T5, T6, T7> right) {
            return Equals(left, right);
          }

    public static bool operator !=(Tuple<T1, T2, T3, T4, T5, T6, T7> left, Tuple<T1, T2, T3, T4, T5, T6, T7> right) {
      return !(left == right);
    }

    #endregion Operators

    #region IEquatable<Tuple<T1, T2, T3, T4, T5, T6, T7>> Members

    public bool Equals(Tuple<T1, T2, T3, T4, T5, T6, T7> other) {
      return  other != null           &&  EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 
               &&  EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 
               &&  EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 
               &&  EqualityComparer<T4>.Default.Equals(Item4, other.Item4) 
               &&  EqualityComparer<T5>.Default.Equals(Item5, other.Item5) 
               &&  EqualityComparer<T6>.Default.Equals(Item6, other.Item6) 
               &&  EqualityComparer<T7>.Default.Equals(Item7, other.Item7) ;           }

    #endregion IEquatable<Tuple<T1, T2, T3, T4, T5, T6, T7>> Members
  }

  #endregion sealed class Tuple<T1, T2, T3, T4, T5, T6, T7>
  
          #region class Tuple<T1, T2, T3, T4, T5, T6, T7, T8>

  [Serializable]
#if !PocketPC && !Smartphone
  [DebuggerDisplay("{ToString()}")]
#endif
  public sealed class Tuple<T1, T2, T3, T4, T5, T6, T7, T8> : IEquatable<Tuple<T1, T2, T3, T4, T5, T6, T7, T8>>
  {
    #region Fields

        private readonly T1 item1;
        private readonly T2 item2;
        private readonly T3 item3;
        private readonly T4 item4;
        private readonly T5 item5;
        private readonly T6 item6;
        private readonly T7 item7;
        private readonly T8 item8;
    
    #endregion Fields

    #region Constructors\Finalizer
    
        public Tuple() { }

        public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) {
            this.item1 = item1;
            this.item2 = item2;
            this.item3 = item3;
            this.item4 = item4;
            this.item5 = item5;
            this.item6 = item6;
            this.item7 = item7;
            this.item8 = item8;
          }

    #endregion Constructors\Finalizer

    #region Properties

        public T1 Item1 {
      [DebuggerStepThrough]
      get { return item1; }
    }

        public T2 Item2 {
      [DebuggerStepThrough]
      get { return item2; }
    }

        public T3 Item3 {
      [DebuggerStepThrough]
      get { return item3; }
    }

        public T4 Item4 {
      [DebuggerStepThrough]
      get { return item4; }
    }

        public T5 Item5 {
      [DebuggerStepThrough]
      get { return item5; }
    }

        public T6 Item6 {
      [DebuggerStepThrough]
      get { return item6; }
    }

        public T7 Item7 {
      [DebuggerStepThrough]
      get { return item7; }
    }

        public T8 Item8 {
      [DebuggerStepThrough]
      get { return item8; }
    }
    
    #endregion Properties
    
    #region Methods

    public string ToString(IFormatProvider provider) {
      return Tuple.ToString(provider, Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8);
    }

    #endregion Methods

    #region Overrides

    public override bool Equals(object obj) {
            return Equals(obj as Tuple<T1, T2, T3, T4, T5, T6, T7, T8>);
          }

    public override int GetHashCode() {
                    return EqualityComparer<T1>.Default.GetHashCode(Item1)
                              ^ Tuple.RotateRight(EqualityComparer<T2>.Default.GetHashCode(Item2), 1)
                              ^ Tuple.RotateRight(EqualityComparer<T3>.Default.GetHashCode(Item3), 2)
                              ^ Tuple.RotateRight(EqualityComparer<T4>.Default.GetHashCode(Item4), 3)
                              ^ Tuple.RotateRight(EqualityComparer<T5>.Default.GetHashCode(Item5), 4)
                              ^ Tuple.RotateRight(EqualityComparer<T6>.Default.GetHashCode(Item6), 5)
                              ^ Tuple.RotateRight(EqualityComparer<T7>.Default.GetHashCode(Item7), 6)
                              ^ Tuple.RotateRight(EqualityComparer<T8>.Default.GetHashCode(Item8), 7);                   }

    public override string ToString() {
      return ToString(null);
    }

    #endregion Overrides
    
    #region Operators

    public static bool operator ==(Tuple<T1, T2, T3, T4, T5, T6, T7, T8> left, Tuple<T1, T2, T3, T4, T5, T6, T7, T8> right) {
            return Equals(left, right);
          }

    public static bool operator !=(Tuple<T1, T2, T3, T4, T5, T6, T7, T8> left, Tuple<T1, T2, T3, T4, T5, T6, T7, T8> right) {
      return !(left == right);
    }

    #endregion Operators

    #region IEquatable<Tuple<T1, T2, T3, T4, T5, T6, T7, T8>> Members

    public bool Equals(Tuple<T1, T2, T3, T4, T5, T6, T7, T8> other) {
      return  other != null           &&  EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 
               &&  EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 
               &&  EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 
               &&  EqualityComparer<T4>.Default.Equals(Item4, other.Item4) 
               &&  EqualityComparer<T5>.Default.Equals(Item5, other.Item5) 
               &&  EqualityComparer<T6>.Default.Equals(Item6, other.Item6) 
               &&  EqualityComparer<T7>.Default.Equals(Item7, other.Item7) 
               &&  EqualityComparer<T8>.Default.Equals(Item8, other.Item8) ;           }

    #endregion IEquatable<Tuple<T1, T2, T3, T4, T5, T6, T7, T8>> Members
  }

  #endregion sealed class Tuple<T1, T2, T3, T4, T5, T6, T7, T8>
  
          #region class Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>

  [Serializable]
#if !PocketPC && !Smartphone
  [DebuggerDisplay("{ToString()}")]
#endif
  public sealed class Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> : IEquatable<Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>>
  {
    #region Fields

        private readonly T1 item1;
        private readonly T2 item2;
        private readonly T3 item3;
        private readonly T4 item4;
        private readonly T5 item5;
        private readonly T6 item6;
        private readonly T7 item7;
        private readonly T8 item8;
        private readonly T9 item9;
    
    #endregion Fields

    #region Constructors\Finalizer
    
        public Tuple() { }

        public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9) {
            this.item1 = item1;
            this.item2 = item2;
            this.item3 = item3;
            this.item4 = item4;
            this.item5 = item5;
            this.item6 = item6;
            this.item7 = item7;
            this.item8 = item8;
            this.item9 = item9;
          }

    #endregion Constructors\Finalizer

    #region Properties

        public T1 Item1 {
      [DebuggerStepThrough]
      get { return item1; }
    }

        public T2 Item2 {
      [DebuggerStepThrough]
      get { return item2; }
    }

        public T3 Item3 {
      [DebuggerStepThrough]
      get { return item3; }
    }

        public T4 Item4 {
      [DebuggerStepThrough]
      get { return item4; }
    }

        public T5 Item5 {
      [DebuggerStepThrough]
      get { return item5; }
    }

        public T6 Item6 {
      [DebuggerStepThrough]
      get { return item6; }
    }

        public T7 Item7 {
      [DebuggerStepThrough]
      get { return item7; }
    }

        public T8 Item8 {
      [DebuggerStepThrough]
      get { return item8; }
    }

        public T9 Item9 {
      [DebuggerStepThrough]
      get { return item9; }
    }
    
    #endregion Properties
    
    #region Methods

    public string ToString(IFormatProvider provider) {
      return Tuple.ToString(provider, Item1, Item2, Item3, Item4, Item5, Item6, Item7, Item8, Item9);
    }

    #endregion Methods

    #region Overrides

    public override bool Equals(object obj) {
            return Equals(obj as Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>);
          }

    public override int GetHashCode() {
                    return EqualityComparer<T1>.Default.GetHashCode(Item1)
                              ^ Tuple.RotateRight(EqualityComparer<T2>.Default.GetHashCode(Item2), 1)
                              ^ Tuple.RotateRight(EqualityComparer<T3>.Default.GetHashCode(Item3), 2)
                              ^ Tuple.RotateRight(EqualityComparer<T4>.Default.GetHashCode(Item4), 3)
                              ^ Tuple.RotateRight(EqualityComparer<T5>.Default.GetHashCode(Item5), 4)
                              ^ Tuple.RotateRight(EqualityComparer<T6>.Default.GetHashCode(Item6), 5)
                              ^ Tuple.RotateRight(EqualityComparer<T7>.Default.GetHashCode(Item7), 6)
                              ^ Tuple.RotateRight(EqualityComparer<T8>.Default.GetHashCode(Item8), 7)
                              ^ Tuple.RotateRight(EqualityComparer<T9>.Default.GetHashCode(Item9), 8);                   }

    public override string ToString() {
      return ToString(null);
    }

    #endregion Overrides
    
    #region Operators

    public static bool operator ==(Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> left, Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> right) {
            return Equals(left, right);
          }

    public static bool operator !=(Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> left, Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> right) {
      return !(left == right);
    }

    #endregion Operators

    #region IEquatable<Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>> Members

    public bool Equals(Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> other) {
      return  other != null           &&  EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 
               &&  EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 
               &&  EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 
               &&  EqualityComparer<T4>.Default.Equals(Item4, other.Item4) 
               &&  EqualityComparer<T5>.Default.Equals(Item5, other.Item5) 
               &&  EqualityComparer<T6>.Default.Equals(Item6, other.Item6) 
               &&  EqualityComparer<T7>.Default.Equals(Item7, other.Item7) 
               &&  EqualityComparer<T8>.Default.Equals(Item8, other.Item8) 
               &&  EqualityComparer<T9>.Default.Equals(Item9, other.Item9) ;           }

    #endregion IEquatable<Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>> Members
  }

  #endregion sealed class Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>
  
    #region class Tuple

  public static class Tuple
  {
    #region Methods
    
    #region Helpers

    [DebuggerStepThrough]
    internal static int RotateRight(int value, int places) {
      if((places &= 0x1F) == 0) {
        return value;
      }//if

      var mask = ~0x7FFFFFFF >> (places - 1);
      return ((value >> places) & ~mask) | ((value << (32 - places)) & mask);
    }

    [DebuggerStepThrough]
    internal static string ToString(IFormatProvider provider, params object[] values) {
      if(values != null) {
        const char Start = '(';
        const char End = ')';
        const string Separator = ", ";

        return Start + String.Join(Separator, values.Select(value => Convert.ToString(value, provider)).ToArray()) + End;
      }//if
      return String.Empty;
    }

    #endregion Helpers

    #region New(…)

    	              [DebuggerStepThrough]
    [Obsolete("Use 'Create' instead to be in sync with Net4.0 ")]
    public static Tuple<T1, T2> New<T1, T2>(T1 item1, T2 item2) {
      return new Tuple<T1, T2>(item1, item2);
    } 

    
    [DebuggerStepThrough]
    public static Tuple<T1, T2> Create<T1, T2>(T1 item1, T2 item2) {
      return new Tuple<T1, T2>(item1, item2);
    } 

    	              [DebuggerStepThrough]
    [Obsolete("Use 'Create' instead to be in sync with Net4.0 ")]
    public static Tuple<T1, T2, T3> New<T1, T2, T3>(T1 item1, T2 item2, T3 item3) {
      return new Tuple<T1, T2, T3>(item1, item2, item3);
    } 

    
    [DebuggerStepThrough]
    public static Tuple<T1, T2, T3> Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3) {
      return new Tuple<T1, T2, T3>(item1, item2, item3);
    } 

    	              [DebuggerStepThrough]
    [Obsolete("Use 'Create' instead to be in sync with Net4.0 ")]
    public static Tuple<T1, T2, T3, T4> New<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4) {
      return new Tuple<T1, T2, T3, T4>(item1, item2, item3, item4);
    } 

    
    [DebuggerStepThrough]
    public static Tuple<T1, T2, T3, T4> Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4) {
      return new Tuple<T1, T2, T3, T4>(item1, item2, item3, item4);
    } 

    	              [DebuggerStepThrough]
    [Obsolete("Use 'Create' instead to be in sync with Net4.0 ")]
    public static Tuple<T1, T2, T3, T4, T5> New<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) {
      return new Tuple<T1, T2, T3, T4, T5>(item1, item2, item3, item4, item5);
    } 

    
    [DebuggerStepThrough]
    public static Tuple<T1, T2, T3, T4, T5> Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) {
      return new Tuple<T1, T2, T3, T4, T5>(item1, item2, item3, item4, item5);
    } 

    	              [DebuggerStepThrough]
    [Obsolete("Use 'Create' instead to be in sync with Net4.0 ")]
    public static Tuple<T1, T2, T3, T4, T5, T6> New<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) {
      return new Tuple<T1, T2, T3, T4, T5, T6>(item1, item2, item3, item4, item5, item6);
    } 

    
    [DebuggerStepThrough]
    public static Tuple<T1, T2, T3, T4, T5, T6> Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) {
      return new Tuple<T1, T2, T3, T4, T5, T6>(item1, item2, item3, item4, item5, item6);
    } 

    	              [DebuggerStepThrough]
    [Obsolete("Use 'Create' instead to be in sync with Net4.0 ")]
    public static Tuple<T1, T2, T3, T4, T5, T6, T7> New<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) {
      return new Tuple<T1, T2, T3, T4, T5, T6, T7>(item1, item2, item3, item4, item5, item6, item7);
    } 

    
    [DebuggerStepThrough]
    public static Tuple<T1, T2, T3, T4, T5, T6, T7> Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) {
      return new Tuple<T1, T2, T3, T4, T5, T6, T7>(item1, item2, item3, item4, item5, item6, item7);
    } 

    	              [DebuggerStepThrough]
    [Obsolete("Use 'Create' instead to be in sync with Net4.0 ")]
    public static Tuple<T1, T2, T3, T4, T5, T6, T7, T8> New<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) {
      return new Tuple<T1, T2, T3, T4, T5, T6, T7, T8>(item1, item2, item3, item4, item5, item6, item7, item8);
    } 

    
    [DebuggerStepThrough]
    public static Tuple<T1, T2, T3, T4, T5, T6, T7, T8> Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) {
      return new Tuple<T1, T2, T3, T4, T5, T6, T7, T8>(item1, item2, item3, item4, item5, item6, item7, item8);
    } 

    	              [DebuggerStepThrough]
    [Obsolete("Use 'Create' instead to be in sync with Net4.0 ")]
    public static Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> New<T1, T2, T3, T4, T5, T6, T7, T8, T9>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9) {
      return new Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>(item1, item2, item3, item4, item5, item6, item7, item8, item9);
    } 
    
    [DebuggerStepThrough]
    public static Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> Create<T1, T2, T3, T4, T5, T6, T7, T8, T9>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8, T9 item9) {
      return new Tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9>(item1, item2, item3, item4, item5, item6, item7, item8, item9);
    } 
    
    #endregion New(…)

    #endregion Methods
  }
  
  #endregion class Tuple
}
